$(function(){
		
	
	$('#pad').click(function(){
		 var li=$("ul").find(".active");//获得所有被选中的li
		 if(li.length===0){
			 zebra_Dialog_warning("请选择数据!");
		 }else{
			 var ids="";
			 li.each(function(){
					var id=$(this).attr("id");
					ids+=id+",";
			});
			 window.location.href="synPage?ids="+ids;
		 }
	});
	$('#computer').click(function(){
		var li=$("ul").find(".active");//获得所有被选中的li
		if(li.length===0){
			 zebra_Dialog_warning("请选择数据!");
		}else{
			var ids="";
			li.each(function(){
				var id=$(this).attr("id");
				ids+=id+",";
			});
			window.location.href="backPage?ids="+ids;
		}
	});
	
	$('#usb').click(function(){
		var li=$("ul").find(".active");//获得所有被选中的li
		if(li.length===0){
			 zebra_Dialog_warning("请选择数据!");
		}else{
			var ids="";
			li.each(function(){
				var id=$(this).attr("id");
				ids+=id+",";
			});
			//window.location.href="backUDisk?ids="+ids;
			$.ajax({
		        type: "post",
		        url:"backUDisk?ids="+ids,
		        success: function(data){
		        	if(data){
		        		zebra_Dialog_success("备份到U盘ietm文件目录下成功!");
		        		//window.location.href="dataBackup.html";
		        	}
		        	
		       }
		    });
		}
	});
	
});
function shareWriter(){
	var comId=$("#comId").val();
	if(comId!==""){
		$.ajax({
	        type: "post",
	        url: "/shareWriter",
	        data:{padIp:comId},
	        success: function(data){
	        	if(data){
	        		zebra_Dialog_success("同步成功!");
	        		window.location.href="dataBackup.html";
	        	}	
	       }
	    });
	}else{
		zebra_Dialog_warning("请输入正确的地址!");
	}
	
}
function synPad(){
	var padIp=$("#ip").val();
	var ids=$("#ids").val();
	if(/(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)/.test(padIp)){
		$.ajax({
	        type: "post",
	        url: "/synPad",
	        data:{padIp:padIp,ids:ids},
	        success: function(){
	        	zebra_Dialog_success("同步成功!");
	        	window.location.href="dataBackup.html";
	       }
	    });
	}else{
		zebra_Dialog_warning("请输入正确的ip地址!");
	}
}